<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/9/8
  Time: 11:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>登录--汽车租赁系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="icon" href="${pageContext.request.contextPath}/static/favicon.ico">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/public.css" media="all" />
</head>
<body class="loginBody">
<form class="layui-form" id="form1"  action="${pageContext.request.contextPath}/user/login" method="post">
    <div class="login_face"><img src="${pageContext.request.contextPath}/static/images/face.jpg" class="userAvatar"></div>
    <div class="layui-form-item input-item">
        <label>用户名</label>
        <input type="text" placeholder="请输入用户名" autocomplete="off" id="loginname" name="loginname" class="layui-input" lay-verify="required" value="hql">
    </div>
    <div class="layui-form-item input-item">
        <label for="password">密码</label>
        <input type="password" placeholder="请输入密码" autocomplete="off" id="password" name="pwd" class="layui-input" lay-verify="required" value="123456">
    </div>
    <div class="layui-form-item input-item" id="imgCode">
        <label for="code">验证码</label>
        <input type="text" placeholder="请输入验证码" autocomplete="off" id="code" name="code" class="layui-input" lay-verify="required" onblur="chkYzm()" value="1111">
        <img id="img" src="${pageContext.request.contextPath}/user/generateYzm" onclick="autoYzm()">
    </div>
    <span style="color:red" id="span1"></span>
    <div class="layui-form-item">
        <button class="layui-btn layui-block" lay-filter="login" lay-submit>登录</button>
    </div>
    <div class="layui-form-item layui-row" style="color: red;">
        ${msg}
    </div>
</form>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/login.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/cache.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-3.3.1.min.js"></script>
<script>
    function autoYzm(){
        $("#img").attr("src","${pageContext.request.contextPath}/user/generateYzm?id="+new Date());
    }
    function chkYzm(){
        var code=$("[name='code']").val();
        $.post("${pageContext.request.contextPath}/user/chkYzm",{"code1":code},function(r){
          if(r!=0){
              $("#span1").html("验证码错误")
              autoYzm();
          }else{
              $("#span1").html("验证码正确")
          }
        })
    }
</script>
</body>
</html>

